﻿using System;
using System.IO;
using System.Linq;

namespace 文件夹内的文件比较
{
    class Program
    {
        static void Main(string[] args)
        {
            var oldPath = @"D:\1-f-codes\elasticsearch\gis-codes\grpc-service-samples\GIS - 副本\SourceCode\Server\LocationSearch\Stee.GIS.LocationSearch\Stee.GIS.LocationSearch.WebAPI\bin\Debug\netcoreapp3.1";
            var newPath = @"D:\1-f-codes\elasticsearch\gis-codes\GIS\src\LocationSearch\Stee.GIS.LocationSearch\Stee.GIS.LocationSearch.WebAPI\bin\Debug\netcoreapp3.1";
            var oldFiles = new 文件操作().得到文件夹中所有文件(oldPath).Select(x=>x.Name).ToList();
            var newFiles = new 文件操作().得到文件夹中所有文件(newPath).Select(x => x.Name).ToList();
            var list1 = oldFiles.Intersect(newFiles);
            Console.WriteLine("没有的");
            list1.ToList().ForEach(x => Console.WriteLine(x));

            var list2 = oldFiles.Concat(newFiles).Except(oldFiles.Intersect(newFiles));

            Console.WriteLine("有的");
            list2.ToList().ForEach(x => Console.WriteLine(x));
            Console.WriteLine("Hello World!");
        }
    }
}
